import { createApp } from 'vue'
import App from './App.vue'
import 'animate.css/animate.min.css'
import router from './router'

// element css
import 'element-plus/dist/index.css'
// element dark css
import 'element-plus/theme-chalk/dark/css-vars.css'

import '@/styles/index.scss' // 加载全局样式
// iconfont css
import '@/assets/iconfont/iconfont.scss'
// font css
import '@/assets/fonts/font.scss'

// custom directives
import directives from '@/directives/index'
// errorHandler
// import errorHandler from '@/utils/errorHandler'
// vue i18n
import I18n from '@/languages/index'
import { ElMessage } from 'element-plus'
import pinia from '@/store'

import { globalConfig } from '@/config/index' // 导入全局配置
import { LocalStorage } from '@/hooks/localStorage/localstorage' //
const app = createApp(App)
// const modules = import.meta.globEager('./components/**/index.ts')
// for (const path in modules) {
//   console.log(`--------注册组件 : ${path} ---------`)
//   app.use(modules[path].default) // 自动注册全局组件
// }

console.log('打印：process.env 环境变量 -> ', process.env)

//app.config.errorHandler = errorHandler
app.config.globalProperties.$globalConfig = globalConfig
app.config.globalProperties.$message = ElMessage

app.use(LocalStorage)
app.use(pinia)
app.use(directives)
app.use(I18n)

app.use(router).mount('#app')
